package com.my.hp_hr.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class LeaveDayUtil {
    public static String dateToDays(String start_time,String end_time){
        String days_str="";
        long days=0;
        try {
            SimpleDateFormat stf = new SimpleDateFormat("yyyy-MM-dd");
            Date date1 = stf.parse(start_time);
            Date date2 = stf.parse(end_time);
            long time1 = date1.getTime();
            long time2 = date2.getTime();
           days=(time2-time1)/1000/60/60/24;
        } catch (ParseException e) {
            e.printStackTrace();
        }
        days_str=String.valueOf(days);
        return days_str;
    }
    }

